import request from '@/utils/request'


// 获取行政区域数据
export function getRegionData(page, limit, name, code) {
    if (name || code) {
        return request({
            url: `/admin/region/list?page=${page}&limit=${limit}&name=${name}&code=${code}`,
            method: 'get',
        }) 
        
    } else {
        return request({
            url: `/admin/region/list?page=${page}&limit=${limit}`,
            method: 'get',
        })  
    }
    
}


// 品牌制造商
export function getBrandData(page, limit, id, name) {
    if (id || name) {
        return request({
            url: `/admin/brand/list?page=${page}&limit=${limit}&id=${id}&name=${name}&sort=add_time&order=desc`,
            method: 'get',
        }) 
          
    } else {
        return request({
            url: `/admin/brand/list?page=${page}&limit=${limit}&sort=add_time&order=desc`,
            method: 'get',
        }) 
    }
    
}
// 添加新品牌商数据
export function createNewBrand(data) {
    return request({
        url: '/admin/brand/create',
        method: 'post',
        data
    })
}

// 更新品牌商数据
export function updateBrand(data) {
    return request({
        url: '/admin/brand/update',
        method: 'post',
        data
    })
}

// 删除品牌商数据
export function deleteBrand(data) {
    return request({
        url: '/admin/brand/delete',
        method: 'post',
        data
    })
}